package com.aistar.service.impl;

import com.aistar.mapper.DishImageMapper;
import com.aistar.pojo.DishImage;
import com.aistar.pojo.DishImageExample;
import com.aistar.service.DishImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DishImageServiceImpl implements DishImageService {
    @Autowired
    private DishImageMapper dishImageMapper;
    @Override
    public DishImage getById(Integer id) {
      return   this.dishImageMapper.selectByPrimaryKey(id);

    }

    @Override
    public List<DishImage> getByDishId(Integer dishId) {

        DishImageExample dishImageExample =  new DishImageExample();
        DishImageExample.Criteria criteria = dishImageExample.createCriteria();
        criteria.andDishIdEqualTo(dishId);
        List<DishImage> dishImageList =  dishImageMapper.selectByExample(dishImageExample);
        return dishImageList;
    }
}
